<?php

namespace Wgx\Admin\Com\Crud\EditPageInput;

use Wgx\Admin\Com\Crud\EditPageInputBase;

class InputCustomize extends EditPageInputBase
{
    /** @var bool */
    private $isRequired;
    /** @var null|string */
    private $specParam;

    /**
     * InputCustomize constructor.
     * @param mixed $origValue - 原值
     * @param bool $isRequired
     * @param null|string $specParam - 额外指定的参数, 自定义用户输入控件的 dom
     */
    public function __construct($origValue, $isRequired = false, $specParam = null)
    {
        $this->origValue = $origValue;
        $this->isRequired = $isRequired;
        $this->specParam = $specParam;
    }

    /**
     * @inheritDoc
     */
    public function getInputType()
    {
        return self::InputCustomize;
    }

    /**
     * @inheritDoc
     */
    public function getIsRequired()
    {
        return $this->isRequired;
    }

    /**
     * @param bool $isRequired
     * @return InputCustomize
     */
    public function setIsRequired($isRequired)
    {
        $this->isRequired = $isRequired;
        return $this;
    }

    /**
     * 额外指定的参数, 自定义用户输入控件的 dom
     * @return string|null
     */
    public function getSpecParam()
    {
        return $this->specParam;
    }

    /**
     * @param string|null $specParam - 额外指定的参数, 自定义用户输入控件的 dom
     * @return InputCustomize
     */
    public function setSpecParam($specParam)
    {
        $this->specParam = $specParam;
        return $this;
    }
}